#coding:utf-8
from __future__ import unicode_literals

from django.db import models

# Create your models here.


class Product(models.Model):
    num = models.CharField(max_length=255)
    chinese_name = models.CharField(max_length=255)
    english_name = models.CharField(max_length=255)
    packageLength = models.IntegerField(default=0)
    packageWidth = models.IntegerField(default=0)
    packageHeight = models.IntegerField(default=0)
    grossWeight = models.IntegerField(default=0)
    supplier_name = models.CharField(max_length=255)
    supplier_url = models.CharField(max_length=255)
    supplier_note = models.CharField(max_length=255)
    CREATE_DATE = models.DateTimeField(auto_now=True)
    CREATE_USER_ID = models.IntegerField(default=0)
    CREATE_USER_NAME = models.CharField(max_length=255)
    MODIFY_DATE = models.DateTimeField(auto_now=True)
    MODIFY_USER_ID = models.IntegerField(default=0)
    MODIFY_USER_NAME = models.CharField(max_length=255)
    class Meta:
        verbose_name = u'系统产品库'
        verbose_name_plural = verbose_name
        db_table = 'sys_product'

    def __unicode__(self):
        return self.ID

class ProductImg(models.Model):
    productId = models.IntegerField(default=0)
    image_url = models.CharField(max_length=255)
    weight = models.IntegerField(default=0)
    CREATE_DATE = models.DateTimeField(auto_now=True)
    class Meta:
        verbose_name = u'系统产品库图片'
        verbose_name_plural = verbose_name
        db_table = 'sys_product_img'

    def __unicode__(self):
        return self.ID

class ProductProperty(models.Model):
    productId = models.IntegerField(default=0)
    attrNameId = models.IntegerField(default=0)
    attrName = models.CharField(max_length=255)
    attrValueId = models.IntegerField(default=0)
    attrValue = models.CharField(max_length=255)
    CREATE_DATE = models.DateTimeField(auto_now=True)

    class Meta:
        verbose_name = u'系统产品库产品属性'
        verbose_name_plural = verbose_name
        db_table = 'sys_product_property'

    def __unicode__(self):
        return self.ID

class ProductSKU(models.Model):
    productId = models.IntegerField(default=0)
    skuPrice = models.DecimalField(default=0.00,max_digits=11,decimal_places=3)
    sku = models.CharField(max_length=255)
    status = models.IntegerField(default=0)
    category = models.CharField(max_length=255)
    purchaseUserId = models.IntegerField(default=0)
    unSendCount = models.IntegerField(default=0)
    sellCount1 = models.IntegerField(default=0)
    sellCount2 = models.IntegerField(default=0)
    sellCount3 = models.IntegerField(default=0)
    weight = models.IntegerField(default=0)
    currencyCode = models.CharField(max_length=255)
    realStock = models.IntegerField(default=0)
    storage_num = models.CharField(max_length=255)
    addPrice = models.DecimalField(default=0.00,max_digits=11,decimal_places=3)
    CREATE_DATE = models.DateTimeField(auto_now=True)
    CREATE_USER_ID = models.IntegerField(default=0)

    class Meta:
        verbose_name = u'系统产品库SKU'
        verbose_name_plural = verbose_name
        db_table = 'sys_product_sku'

    def __unicode__(self):
        return self.ID

class ProductSkuProperty(models.Model):
    productId = models.IntegerField(default=0)
    sku = models.CharField(max_length=255)
    skuPropertyId = models.IntegerField(default=0)
    propertyValueId = models.IntegerField(default=0)
    propertyValueDefinitionName = models.CharField(max_length=255)
    skuImage = models.CharField(max_length=255)
    CREATE_DATE = models.DateTimeField(auto_now=True)

    class Meta:
        verbose_name = u'系统产品库SKU属性'
        verbose_name_plural = verbose_name
        db_table = 'sys_product_sku_property'

    def __unicode__(self):
        return self.ID

class Pruchase(models.Model):
    SKUID = models.IntegerField(default=0)
    QTY = models.IntegerField(default=0)
    TOTALPRICE = models.CharField(max_length=255)
    NOTE = models.CharField(max_length=255)
    CREATE_USER_ID = models.IntegerField(default=0)
    CREATE_USER_NAME = models.CharField(max_length=255)
    CREATE_DATE = models.DateTimeField(auto_now=True)
    MODIFY_USER_ID = models.IntegerField(default=0)
    MODIFY_USER_NAME = models.CharField(max_length=255)
    MODIFY_DATE = models.DateTimeField(auto_now=True)

    class Meta:
        verbose_name = u'采购记录'
        verbose_name_plural = verbose_name
        db_table = 'sys_purchase'

    def __unicode__(self):
        return self.ID

class Productlibrary(models.Model):
    NUMBERS=models.CharField(max_length=255)
    IMAGE=models.CharField(max_length=255,null=True)
    CHANGJIAURL=models.CharField(max_length=255,null=True)
    CREATE_TIME=models.DateTimeField(auto_now=True)
    NOTE=models.CharField(max_length=255,null=True)
    NAME=models.CharField(max_length=255,null=True)
    CHANGJIANAME=models.CharField(max_length=255)
    PRODUCTWEIGHT=models.DecimalField(default=0.00,max_digits=11,decimal_places=2)
    TOTALWEIGTH=models.DecimalField(max_digits=11,decimal_places=2)
    USER_ID=models.IntegerField(default=0)
    USER_NAME=models.CharField(max_length=255,null=True)
    TOTALWEIGTH=models.DecimalField(default=0.00,max_digits=11,decimal_places=2)
    class Meta:
        verbose_name = u'产品库'
        verbose_name_plural = verbose_name
        db_table = 'e_productlibrary'

    def __unicode__(self):
        return self.NUMBERS